<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>个人中心</title>
    <link rel="stylesheet" href="layui/css/layui.css" />
    <link rel="shortcut icon" href="img/logo.ico" type="image/x-icon" />
    <link rel="stylesheet" href="css/usercenter.css" />

    <!-- layui -->
    <script src="layui/layui.js"></script>
    <script src="js/jquery-3.4.1.js"></script>

    <!-- Markdown编辑器 -->
    <link rel="stylesheet" href="/css/editormd.css" />
    <script src="/js/editormd.js"></script>

    <!-- 表情 -->
    <script src="/js/emoji_jQuery.min.js"></script>
</head>

<body>
    <div id="container">
        <nav>
            <ul class="layui-nav" lay-filter="">
                <li class="layui-nav-item"><a href="/main/1">博客页</a></li>
                <li class="layui-nav-item layui-this"><a href="">个人中心</a></li>
                <li class="Picture">
                    <span class="picturespan">
                        <img src="./photo/<%=user.photo%>" alt="" />
                    </span>
                    <a id="cancellation">退出登录</a>
                </li>
            </ul>
        </nav>
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title">
                <li class="layui-this">个人信息</li>
                <li>修改密码</li>
                <li>上传头像</li>
                <!-- <li>发表日志</li> -->
                <%if(user.isAdmin){%>
                <li>发表博客</li>
                <li>博客管理</li>
                <li>用户管理</li>
                <%}%>
            </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <table class="layui-table">
            <colgroup>
                <col width="25%" />
                <col width="50%" />
                <col />
            </colgroup>
            <thead>
                <tr>
                <th>栏目</th>
                <th>值</th>
                <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                <td>用户名</td>
                <td><%=user.userName%></td>
            <td rowspan="6" id="operation">
                <button type="button" class="layui-btn layui-btn-lg" id="modify">
                    修改信息
                </button>
            </td>
            </tr>
            <tr>
                <td>性别</td>
                <td><%=user.sex%></td>
            </tr>
            <tr>
                <td>年龄</td>
                <td><%=user.age%></td>
            </tr>
            <tr>
                <td>邮箱</td>
                <td><%=user.email%></td>
            </tr>
            <tr>
                <td>电话</td>
                <td><%=user.phone%></td>
            </tr>
            <tr>
                <td>个性签名</td>
                <td><%=user.signature%></td>
            </tr>
            </tbody>
            </table>
            </div>

        <!-- 修改密码 -->
        <div class="layui-tab-item">
            <form class="layui-form" action="" id="pwdform">
                <div class="layui-form-item" style="display: none;">
                    <label class="layui-form-label">用户ID</label>
                    <div class="layui-input-block">
                        <input type="text" name="_id" required lay-verify="required" placeholder="请输入用户名"
                            autocomplete="off" class="layui-input" value="<%=user._id%>" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="text" name="oldpsw" placeholder="请输入旧密码" required lay-verify="oldpassword"
                            autocomplete="off" class="layui-input" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="text" name="newpsw" id="r_password" placeholder="请输入新密码" required
                            lay-verify="newpassword" autocomplete="off" class="layui-input" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="text" name="newpsw" required lay-verify="repassword" placeholder="请输入新密码"
                            autocomplete="off" class="layui-input" />
                    </div>
                </div>

                <div class="layui-form-item pwdbutton">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formpassword">
                            确认修改
                        </button>
                        <button type="reset" class="layui-btn layui-btn-primary">
                            重置
                        </button>
                    </div>
                </div>
            </form>
        </div>

        <!-- 上传头像 -->
        <div class="layui-tab-item">
            <button type="button" class="layui-btn" id="upload">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
        </div>

        <!--发表日志 -->
        <!-- <div class="layui-tab-item">
            <div id="test"></div>
            <div id="div-emoji">
                <p>
                    <textarea name="" id="input" cols="30" rows="10" placeholder="请输入文字"></textarea>
                </p>
                <p>
                    <button id="send">发表</button>
                    <button id="btn">添加表情</button>
                </p>
            </div>
        </div> -->

        <%if(user.isAdmin){%>
        <!--发表文章  -->
        <div class="layui-tab-item">
            <form class="layui-form">
                <div class="layui-form-item">
                    <button type="button" class="layui-btn" lay-filter="articel" id="markdown">
                        使用Markdown编辑器
                    </button>
                    <div class="layui-input-block">
                        <input type="text" style="display: none ;" name="id" required autocomplete="off"
                            class="layui-input" value="<%=user._id%>" />
                        <input type="text" id="title" name="title" required lay-filter="articeltitle"
                            placeholder="请输入标题" autocomplete="off" class="layui-input" />
                    </div>
                </div>
                <div class="tags" id="tags">
                    <input type="text" name="" id="inputTags" placeholder="回车生成标签" autocomplete="off" />
                </div>
                <textarea id="demo" style="display: none;"></textarea>
                <div class="layui-form-item article-button">
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn" lay-submit lay-filter="articel">
                            立即发表
                        </button>
                    </div>
                </div>
            </form>
        </div>

        <!--博客管理 -->
        <div class="layui-tab-item">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <div class="layui-input-block search-item">
                        <input type="text" name="keyword"  placeholder="请输入关键词"
                            autocomplete="off" class="layui-input">
                        <button class="layui-btn" lay-submit lay-filter="search">搜索</button>
                    </div>
                </div>
            </form>
            <table class="layui-table">
                <colgroup>
                    <col width="40%">
                    <col width="30%">
                    <col>
                </colgroup>
                <thead>
                    <tr>
                        <th>博客名称</th>
                        <th>发表时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="manager">
                    

                </tbody>
            </table>

        </div>
        <!-- 用户管理 -->
        <div class="layui-tab-item">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <div class="layui-input-block search-item">
                        <input type="text" name="keyword"  placeholder="请输入关键词,不输入则查找全部"
                            autocomplete="off" class="layui-input">
                        <button class="layui-btn" lay-submit lay-filter="searchuser">搜索</button>
                    </div>
                </div>
            </form>
            <table class="layui-table">
                <colgroup>
                    <col width="40%">
                    <col width="30%">
                    <col>
                </colgroup>
                <thead>
                    <tr>
                        <th>用户名</th>
                        <th>注册时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="usermanager">
                    

                </tbody>
            </table>

        </div>
        <%}%>
            </div>
        </div>
    </div>
    <div id="box">
      <div id="formbox">
        <div id="formtitle">个人信息修改</div>
        <form class="layui-form" action="">
          <div class="layui-form-item" style="display: none;">
            <label class="layui-form-label">用户ID</label>
            <div class="layui-input-block">
              <input type="text" name="_id" required lay-verify="required" placeholder="请输入用户名"
                autocomplete="off"
                class="layui-input"
                value="<%=user._id%>"
        />
    </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="userName" required lay-verify="required" placeholder="请输入用户名" autocomplete="off"
                class="layui-input" value="<%=user.userName%>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="男" title="男" />
            <input type="radio" name="sex" value="女" title="女" checked />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">年龄</label>
        <div class="layui-input-block">
            <input type="text" name="age" lay-verify="age" placeholder="请输入年龄" autocomplete="off" class="layui-input"
                value="<%=user.age%>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-block">
            <input type="text" name="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input"
                value="<%=user.email%>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-block">
            <input type="text" name="phone" placeholder="请输入电话" autocomplete="off" class="layui-input"
                value="<%=user.phone%>" />
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">个性签名</label>
        <div class="layui-input-block">
            <input type="text" name="signature" lay-verify="signature" maxlength="30" placeholder="请输入个性签名，最大字数为30"
                autocomplete="off" class="layui-input" value="<%=user.signature%>" />
        </div>
    </div>
    <div class="layui-form-item button-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">
                立即提交
            </button>
            <button id="close" class="layui-btn layui-btn-primary">
                关闭
            </button>
        </div>
    </div>
    </form>
    </div>
    </div>
</body>
<script src="/js/usercenter.js"></script>
</html>